<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/8/8
 * Time: 10:41
 */

namespace App\Models\Admin;
use Illuminate\Database\Eloquent\Model;


class Log extends Model
{
    protected $table = 'admin_log';
    public $timestamps = false;

    /**
     * 添加日志
     * @param array $user
     * @param string $action
     * @return bool
     */
    public function add($user, $action = '')
    {
        $this->uid = $user['id'];
        $this->username = $user['username'];
        $this->action = $action;
        $this->create_at = date('Y-m-d H:i:s');
        $this->save();

        return true;
    }
}